import time
from Page import Page
from selenium.webdriver.common.by import By
class Page2(Page):
# 点击输入框
    xw=(By.XPATH,'//*[@id="key"]')
    def xw_loc(self):
        self.send_keys(self.xw,'电脑')
    # 点击搜索按钮
    ss=(By.XPATH,'//*[@id="header_wrap"]/div/div[2]/div[1]/button')
    def ss_loc(self):
        self.click(self.ss)
    dy1=(By.XPATH,'//*[@id="search-condition"]/div[1]/span')
    def dy1_loc(self):
        self.text(self.dy1)

    def baidu2(self):
        self.open('https://www.jd.com/')
        self.xw_loc()
        time.sleep(2)
        self.ss_loc()
        time.sleep(2)
        print(self.dy1_loc())
        time.sleep(5)
